<template>
  <div class="detail-swiper">
    <swiper>
      <!-- 根据图片数量动态生成swiper-item -->
      <swiper-item v-for="(item,index) in topImages" :key="index"
                  class="swiper-item">
        <img :src="item" alt="">
      </swiper-item>
    </swiper>
  </div>
</template>
<script>
// 导入轮播图的组件,都在swiper的index.js里面
import {Swiper,SwiperItem} from 'components/common/swiper'

export default {
  name:'DetailSwiper',
  components:{
    Swiper,
    SwiperItem
  },
  props:{
    // 从父组件传过来的轮播图数据
    topImages: {
      type:Array,
      default(){
        return []
      }
    }
  }
}
</script>
<style scoped>
/* 初始的图片太大了，所以直接设置图片的大小 */
.swiper-item{
  height:300px;
  overflow: hidden;
}
</style>
